import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Comparator;

class Student{
    public   String name;
    public  int score;
    public int age;

    public Student(String name, int score, int age) {
        this.name = name;
        this.score = score;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", score=" + score +
                ", age=" + age +
                '}';
    }
}

class NameComparator implements Comparator<Student>{

    @Override
    public int compare(Student o1, Student o2) {
        return o1.name.compareTo(o2.name);
    }
}
class ScoreComparator implements Comparator<Student> {


    @Override
    public int compare(Student o1, Student o2) {
        return o1.score- o2.score;
    }
}

public class Test2 {


    public static void main(String[] args) {

        Student [] students=new Student[3];
        students [0] =new Student("张三",99,18);

        students [1] =new Student("李四",98,17);
        students [2] =new Student("王五",96,16);
        ScoreComparator scoreComparator=new ScoreComparator();


        Arrays.sort(students,scoreComparator);
        System.out.println(Arrays.toString(students));


        NameComparator nameComparator=new NameComparator();
        Arrays.sort(students,nameComparator);
        System.out.println(Arrays.toString(students));

    }
}